package com.example.flower_shop.dto.order;

import com.example.flower_shop.entity.OrderItem;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@NoArgsConstructor
public class OrderItemDTO {
    private Long id;
    private Long productId;
    private String productName;
    private BigDecimal productPrice;
    private Integer quantity;
    private BigDecimal subtotal;

    public OrderItemDTO(OrderItem item) {
        this.id = item.getId();
        this.productId = item.getProduct().getId();
        this.productName = item.getProductName();
        this.productPrice = item.getProductPrice();
        this.quantity = item.getQuantity();
        this.subtotal = item.getSubtotal();
    }
}